<?php 
    $ssFilter      = $this->arrParam['ssFilter'];
    $action_link   = $this->baseUrl($this->currentController . '/filter/type/order');
    
    $lbltourName         = $this->myLinkSort('Tour name', 't.name', $ssFilter, 
    		               $this->imgUrl . '/icon', $action_link);

    $lblID 	             = $this->myLinkSort('ID','t.id',$ssFilter,
    				       $this->imgUrl . '/icon',$action_link);
    
    $lblStatus	         = $this->myLinkSort('Status','t.status',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
    
    $lblOrder	         = $this->myLinkSort('Order','t.order',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
    
    $lblType	         = $this->myLinkSort('Type','t.type',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
    
    $lblLocation_start	 = $this->myLinkSort('Location_start','t.location_start',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
     
    $lblTime_limit       = $this->myLinkSort('Time limit','t.time_limit',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
    
    $lblCategory         = $this->myLinkSort('Category','c.category_name',$ssFilter,
    		               $this->imgUrl . '/icon',$action_link);
    
    
    $keywords   = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort'));
    $linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
    $btnSearch  = $this->formButton('search-now','Search now',
    		array('onclick'=>"OnSubmitForm('" . $linkSearch . "')"));
    $linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');
    $btnResetSearch = $this->formButton('clear-keywords','Clear',
    		array('onclick'=>"OnSubmitForm('" . $linkResetSearch . "')"));
    $strSearch = $keywords . ' ' . $btnSearch . ' ' . $btnResetSearch;
?>  

<form name="appForm" method="post" action="">
       <?php echo $this->render('admin-tour/toolbar/index.php'); ?>
       <?php echo $this->render('admin-tour/sublink/index.php'); ?>
                        <!-- BEGIN: CONTENT -->

                        <div id="element-box">

                            <div class="t">

                                <div class="t">

                                    <div class="t"></div>

                                </div>

                            </div>

                            <div class="m">

                                <!-- BEGIN: ELEMENT BOX -->

                               <div id="filters">
									<div>
										<?php echo $strSearch;?>
									</div>
								</div>	



                                <!-- Area 4: In du lieu lay tu database -->

                                <table class="adminlist">

                                    <thead>

                                        <tr>

                                            <th width="43" ><input type="checkbox" name="checkbox" id="checkbox" onclick="checkedAll()"></th>

                                            <th><?php echo $lbltourName; ?></th>

                                            <th width="34"><?php echo $lblStatus; ?></th>

                                            <th width="60"><?php echo $lblOrder; ?></th>
                                            
                                            <th width="86"><?php echo $lblType; ?></th>
                                            
                                            <th width="140"><?php echo $lblLocation_start; ?></th>
                                            
                                            <th width="140"><?php echo $lblTime_limit; ?></th>
                                            
                                            <th width="86"><?php echo $lblCategory; ?></th>							

                                            <th width="90">Control</th>



                                            <th width="34"><?php echo $lblID; ?></th>

                                        </tr>

                                    </thead>


                                    <?php 
                                        foreach ($this->Items as $key => $value) {
                                        	$id    	       = $value['id'];
                                        	$tour_name     = $value['name'];
                                        	$category      = $value['category_name'];
                                        	$location      = $value['location_start'];
                                        	$time          = $value['time_limit'];
                                        	
                                        	$type          = $value['type'];
                                        	 
                                        	// type of category
                                        	if($type == 0) {
                                        		$type = 'Khách Đoàn';
                                        	}else {
                                        		$type = 'Khách Lẻ';
                                        	}
                                        	$status        = $value['status'];
                                    
                                        	// icon status
                                        	if($status == 1) {
                                        	    $linkstatus =  $this->baseUrl($this->currentController . '/status/type/0/id/' . $id);
                                        	    $imgAtive   =  $this->imgUrl . '/icon/active.png';
                                        	    $iconStatus  = $this->myIconButton('Active', $imgAtive, $linkstatus); 
                                        	}else {
                                        		$linkstatus =  $this->baseUrl($this->currentController . '/status/type/1/id/' . $id);
                                        		$imgAtive   =  $this->imgUrl . '/icon/inactive.png';
                                        		$iconStatus = $this->myIconButton('Active', $imgAtive, $linkstatus);
                                        	}
                                        	
                                        	// Icon Info
                                        	$linkInfo = $this->baseUrl($this->currentController . '/info/id/' . $id);
                                        	$imgInfo  = $this->imgUrl . '/icon_info.png';
                                        	$iconInfo = $this->myIconButton('View Item', $imgInfo, $linkInfo);
                                        	
                                        	// Icon Edit
                                        	$linkEdit = $this->baseUrl($this->currentController . '/edit/id/' . $id);
                                        	$imgEdit  = $this->imgUrl . '/icon_edit.png';
                                        	$iconEdit = $this->myIconButton('Edit Item', $imgEdit, $linkEdit);
                                        	
                                        	
                                        	// Icon Delete
                                        	$linkDelete = $this->baseUrl($this->currentController . '/delete/id/' . $id);
                                        	$imgDelete  = $this->imgUrl . '/icon_del.png';
                                        	$iconDelete = $this->myIconButton('Edit Item', $imgDelete, $linkDelete);
                                        	
                                        	// Icon
                                        	$strIconButton = $iconInfo . ' ' .  $iconEdit . ' ' . $iconDelete;
                                        	
                                        	// form text oder
                                        	$order = $this->formText('order[' . $value['id'] . ']' , $value['order'], array('style'=>'width: 30px; text-align: center;'));
                                        	
                                        	// form checkbox
                                        	$cid   = $this->formCheckBox('cid[]', $value['id']);
                                            
                    
                                    ?>
                                    <tr class="even">						

                                        <td align="center"><?php echo $cid; ?></td>

                                        <td align="left"><?php echo $tour_name; ?></td>

                                        <td align="center"><?php echo $iconStatus; ?></td>

                                        <td align="center"><?php echo $order; ?></td>
                                        
                                        <td align="center"><?php echo $type; ?></td>
                                        
                                        <td align="center"><?php echo $location; ?></td>
                                        
                                        <td align="center"><?php echo $time; ?></td>
                                        
                                        <td align="center"><?php echo $category; ?></td>

                                        <td align="center"><?php echo $strIconButton; ?> </td>

                                        <td align="center"><?php echo $id; ?></td>

                                    </tr>
									<?php } ?>
                                    <!-- BEGIN: PAGINATION (FOOT) -->

                                    <tfoot>

                                        <tr>

                                            <td colspan="9">

                                                <div class="container">

                                                    <div class="pagination">
				
                                                       <?php 
                                                           $currentUrl = $this->baseUrl($this->currentController . '/index');
                                                           echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml', array('currentUrl'=>$currentUrl));
                                                       ?>
                                                        <div class="limit"></div>

                                                    </div>

                                                </div>

                                            </td>

                                        </tr>					

                                    </tfoot>				<!-- END: PAGINATION (FOOT) -->

                                </table>

                                <!-- Area 4: In du lieu lay tu database - End -->



                                <!-- END: ELEMENT BOX -->	

                              <div class="clr"></div>

                            </div>

                            <div class="b">

                                <div class="b">

                                    <div class="b"></div>

                                </div>

                            </div>

                        </div>

                        <!-- END: 	CONTENT -->

                    </form>
